package xyz.ddlnt.serviceusr.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.FollowDTO;
import xyz.ddlnt.model.dto.PageDTO;
import xyz.ddlnt.model.vo.FollowVO;
import xyz.ddlnt.serviceusr.service.FollowService;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/10 21:29
 */
@Slf4j
@RequestMapping("/follow")
@RestController
public class FollowController {
    @Resource
    private FollowService followService;

    /**
     * 关注用户
     * @param followDTO
     * @return
     */
    @PostMapping("/followUser")
    public Result<Boolean> FollowUser(@RequestBody FollowDTO followDTO) {
        return Result.success(followService.FollowUser(followDTO));
    }

    /**
     * 取消关注用户
     * @param followDTO
     * @return
     */
    @PostMapping("/unfollowUser")
    public Result<Boolean> unfollowUser(@RequestBody FollowDTO followDTO) {
        return Result.success(followService.unfollowUser(followDTO));
    }

    /**
     * 判断用户是否关注了某个用户
     * @param followDTO
     * @return
     */
    @PostMapping("/isFollowed")
    public Result<Boolean> isFollowed(@RequestBody FollowDTO followDTO) {
        return Result.success(followService.isFollowed(followDTO));
    }

    /**
     * 获取关注列表
     * @param pageDTO
     * @return
     */
    @PostMapping("/getFollowList")
    public Result<List<FollowVO>> getFollowList(@RequestBody PageDTO pageDTO) {
        return Result.success(followService.getFollowList(pageDTO));
    }

    /**
     * 获取粉丝列表
     * @param pageDTO
     * @return
     */
    @PostMapping("/getFansList")
    public Result<List<FollowVO>> getFansList(@RequestBody PageDTO pageDTO) {
        return Result.success(followService.getFansList(pageDTO));
    }
}
